#include <iostream>
using namespace std;

int main()
{
	int max = 0,day = 0, sum = 0;
	for (int i = 1; i <= 7; i++)
	{
		int s1 = 0, s2 = 0;
		cin >> s1 >> s2;
		sum = s1 + s2;
		if((sum > 8) && (sum > max))
		{	
			max = sum;
			day = i;
		}
	}
	cout << day << endl;
	return 0;
}
